package com.dj.product.k2faas.dto.datasource;

import com.dj.product.k2faas.common.enums.DBType;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * Created by 丁建 on 2025/9/23 09:30
 *
 * @author 丁建
 */
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
@Accessors(chain = true)
public abstract class AbstractDataSourceRequest {
    @NotNull(message = "数据库类型不能为空")
    private DBType type;

    @NotEmpty(message = "数据库连接名不能为空")
    private String name;

    @NotEmpty(message = "数据库连接地址不能为空")
    private String url;

    @NotEmpty(message = "数据库用户名不能为空")
    private String username;

    @NotEmpty(message = "数据库密码不能为空")
    private String password;

    private int connectionTimeout = 60000;

    private int maxPoolSize = 10;

    private int minimumIdle = 3;

    private int idleTimeout = 30000;

    private int maxLifetime = 2000000;

    private boolean autoCommit = true;
}
